import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-09-19
 * Time: 10:23
 */
class MissTwo{
    public  int[] missTwo(int[] nums){
        int ret = 0;
        for(int x : nums) ret ^= x;
        for (int i = 1; i <= nums.length + 2; i++)  ret ^= i;

        int diff = 0;
        while(true){
            if(((ret >> diff) & 1) == 1) break;
            else diff++;
        }

        int[] tmp = new int[2];
        for(int x : nums){
            if(((x >> diff) & 1) == 1) tmp[1] ^= x;
            else tmp[0] ^= x;
        }
        for(int i = 1; i <= nums.length + 2; i++){
            if((i >> diff & 1) == 1) tmp[1] ^= i;
            else tmp[0] ^= i;
        }
        return tmp;
    }
}



public class demo1 {
    public static void main(String[] args) {
        MissTwo missTwo = new MissTwo();
        int[] nums = {2,3};
        int[] ret = missTwo.missTwo(nums);
        Arrays.sort(ret);
        System.out.println(Arrays.toString(ret));
    }
}
